<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="/../Thinkphp/Application/Home/View/User/jquery/jquery-3.0.0.js"></script>
        <script>
            $(function($){
                $("#submit").click(function(){
                    var url=$("form").attr('action');                  
                    var data={};
                    data['name']=$('#username').val();
                    data['pass']=$("#pass").val();
                    var dataType="json";
                    $.post(
                        url,
                        data,
                        function(data){
                            if(data.status===0){
                                $("#text").text(data.info);
                                $("p").css({"font-size" : "15px" , "color" :"red"})
                            }
                            if(data.status===1){
                                location.href=data.url;
                            }
                        },
                        dataType  
                    );
                    return false;    
                });              
                $("#register").click(function(){
                    location.href="<?php print U('admin/user/register');?>";
    });
            });
        </script>
        <style>
            .register{
                display: inline-block;
                position: absolute;
                top: 50px;
                left: 114px;
            }
            .text{
                display: inline-block;
                position: absolute;
                top: -5px;
                 left: 194px;
            }
        </style>
    </head>
    <body>
        <div>
            <form action="<?php print U('admin/user/dologin');?>" method="post">
                <input type="text" name="name" id="username"/><br/>
                <input type="password" name="pass" id="pass"/><br/>             
                <div>
                <p id='text' class='text'></p>
                </div>
                <input type="submit" value="登录" id="submit"/>  
            </form>
             <form  class='register' action="<?php print U('admin/user/register');?>" method="post">
                 <input type="submit" value="注册" id="register"/>
            </form>
        </div>
    </body>
</html>
